﻿using KongMing.WebTools.Common;

namespace KongMing.WebTools.Models
{
    /// <summary>
    /// 字段属性
    /// </summary>
    public class Field
    {
        /// <summary>
        /// 是否是主键
        /// </summary>
        public bool IsPrimaryKey { get; set; }
        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName { get; set; }
        /// <summary>
        /// 数据类型
        /// </summary>
        public string DataType { get; set; } = SqlType.Nvarchar;
        /// <summary>
        /// 长度
        /// </summary>
        public string Length { get; set; } = "";
        /// <summary>
        /// 是否允许null
        /// </summary>
        public bool IsNullable { get; set; }
        /// <summary>
        /// 是否自增
        /// </summary>
        public bool IsIdentity { get; set; }
        /// <summary>
        /// 默认值
        /// </summary>
        public string? DefaultValue { get; set; }
        /// <summary>
        /// 字段注释
        /// </summary>
        public string Remark { get; set; } = "";

        public bool IsBaseField { get; set; }

        #region 处理之后的数据
        public string SqlFieldName { get; set; } = "";
        public string SqlFieldType { get; set; } = SqlType.Nvarchar;
        public string? SqlDefaultValue { get; set; }
        public string CSharpDefaultValue { get; set; } = "";
        public string CSharpFieldType { get; set; } = CShapType.String;
        #endregion
    }
}
